<template>
	<div class="all comment">
		 <div class="all_header">
            <img src="../../assets/img/back.png" alt="" @click="goBack">双十一会场
			
        </div>
		<div style="background:#fee101">
			<div class="banner">
        		<img src="../../assets/img/active/all.png"/>
			 
			</div>
			<div class="banner-tip">
					<img src="../../assets/img/active/huanghuan.png"/>
			</div>
		</div>
        
        <div class="class">
        	<div class="fl left">
				<router-link :to="{path:'/meizhuang',query:{class_id:'5',taoqinggouName:'/brand'}}">
					<img src="../../assets/img/active/meizhuang.png"/>
				</router-link>
        	</div>
        	<div class="fr right">
				<router-link :to="{path:'/muying',query:{class_id:'4',taoqinggouName:'/brand'}}">
						<img class="mb5" src="../../assets/img/active/muying.png"/>
				</router-link>
				<router-link :to="{path:'/jiadian',query:{class_id:'12',taoqinggouName:'/brand'}}">
					<img src="../../assets/img/active/jiadian.png"/>
				</router-link>
        		
        	</div>
        	<div class="bottom">
				<router-link :to="{path:'/jiafang',query:{class_id:'6',taoqinggouName:'/brand'}}">
					<img src="../../assets/img/active/jiafang.png"/>
				</router-link>
        		
        	</div>
        </div>
        <div class="meizhuang">
        	<div class="bar">
        		<img src="../../assets/img/active/meizhuangtui.png"/>
        	</div>
        	<ul class="lists">
        		<li v-for="item in meizhuang" class="list-item" @click="goDetail(item.new_url)">
        			<img :src="'http:'+item.thumb"/>
        			<span class="icon"><img src="../../assets/img/active/meizhuangchuang.png"/>
        			</span>
        			<div class="desc">
        				{{item.title.substring(0,9)}}...
        				<span class="yellow">
        					<span class="red">
        						<img src="../../assets/img/active/price.png"/>
        						<span class="price" style="z-index:222;font-size:13px">{{Math.floor(item.price)}}
									<span class="small-font">{{getNumber(item.price)}}</span>
								</span>
        					</span>
        				</span>
        			</div>
        		</li>
        	</ul>
        </div>
        <div class="muying">
        	<div class="bar">
        		<img src="../../assets/img/active/muyingtui.png"/>
        	</div>
        	<ul class="lists">
        		<li v-for="item in muying" class="list-item" @click="goDetail(item.new_url)">
        			<img :src="'http:'+item.thumb"/>
        			<span class="icon"><img src="../../assets/img/active/muyingkuang.png"/>
        			</span>
        			<div class="desc">
        				{{item.title.substring(0,9)}}...
        				<span class="yellow">
        					<span class="red">
        						<img src="../../assets/img/active/price.png"/>
        						<span class="price" style="z-index:222;font-size:13px">{{Math.floor(item.price)}}
										<span class="small-font">{{getNumber(item.price)}}</span>
								</span>
        					</span>
        				</span>
        			</div>
        		</li>
        	</ul>
        </div>
        <div class="jiadian">
        	<div class="bar">
        		<img src="../../assets/img/active/jiadiantui.png"/>
        	</div>
        	<ul class="lists">
        		<li v-for="item in jiadian" class="list-item" @click="goDetail(item.new_url)">
        			<img :src="'http:'+item.thumb"/>
        			<span class="icon"><img src="../../assets/img/active/jiadiankuang.png"/>
        			</span>
        			<div class="desc">
        				{{item.title.substring(0,9)}}...
        				<span class="yellow">
        					<span class="red">
        						<img src="../../assets/img/active/price.png"/>
        						<span class="price" style="z-index:222;font-size:13px">{{Math.floor(item.price)}}
										<span class="small-font">{{getNumber(item.price)}}</span>
								</span>
        					</span>
        				</span>
        			</div>
        		</li>
        	</ul>
        </div>
        <div class="jiafang">
        	<div class="bar">
        		<img src="../../assets/img/active/jiafangtui.png"/>
        	</div>
        	<ul class="lists">
        		<li v-for="item in jiafang" class="list-item" @click="goDetail(item.new_url)">
        			<img :src="'http:'+item.thumb"/>
        			<span class="icon"><img src="../../assets/img/active/jiafangkuang.png"/>
        			</span>
        			<div class="desc">
        				{{item.title.substring(0,9)}}...
        				<span class="yellow">
        					<span class="red">
        						<img src="../../assets/img/active/price.png"/>
        						<span class="price" style="z-index:222;font-size:13px">{{Math.floor(item.price)}}
										<span class="small-font">{{getNumber(item.price)}}</span>
								</span>
        					</span>
        				</span>
        			</div>
        		</li>
        	</ul>
        </div>
	</div>
</template>

<script>
	import Layer from '../../assets/js/MessageBox'
    import API from '../../assets/js/API'
	export default {
        data() {
        	return {
				meizhuang:[],
				muying:[],
				jiafang:[],
				jiadian:[],
				currentPage:1,
        	}
		},
		created(){
			 window.scrollTo(0,0);
			this.getGoods(5,'meizhuang')
			this.getGoods(4,'muying')
			this.getGoods(12,'jiadian')
			this.getGoods(6,'jiafang')
		},
        methods:{
        	goBack() {
                this.$router.goBack();
			},
			 goDetail(url )
			 {
                    plus.runtime.openURL(url,function(){
						  plus.runtime.openURL(url)
					},'com.taobao.taobao');

			},
			getNumber(price){
				let pri=price+''
				if(pri.indexOf('.')>0){
					 pri=pri.split('.')[1]
					return '.'+pri
				}
			},
			getGoods(class_id,name){
                let url=API.taotejia+'/brand';
                let form=new FormData()
                    form.append('cate',class_id)
                     form.append('page',this.currentPage)
                  this.$http.post(url,form,
                  {
                       headers: {'Content-Type': 'application/x-www-form-urlencoded,multipart/form-data'}
                  }
                  ).then(
                (res) => {
					if(res.body.code==1){
							console.log(res.body.data)
							this.products=res.body.data.result; 
							if(name=='meizhuang'){
								this.meizhuang=this.products.slice(this.products.length-5,this.products.length-1)
							}else if(name=='muying'){
								this.muying=this.products.slice(this.products.length-5,this.products.length-1)
							}else if(name=='jiadian'){
								this.jiadian=this.products.slice(this.products.length-5,this.products.length-1)
							}else{
								this.jiafang=this.products.slice(this.products.length-5,this.products.length-1)
							}
						
					}
					 else {
                        Layer.showMsg("获取列表失败！");
                    }
                },
                (error) => {
                    Layer.showMsg("服务器开小差了...")
                    return
                }
            )

			},
        }
   }
</script>

<style>
	@import url("./all.css");
</style>